<template>
	<scroll-view :enable-flex="true" :show-scrollbar="false" @scrolltolower="lower" :scroll-y="true"
	style="display: flex;flex-direction: column; align-items: center;height: 100vh;">
		
		<!-- 顶部分割线 -->
		<view style="width: 100%;height: 20rpx;background-color: #F7F8FF;margin-top: 26rpx;"></view>
		
		<!-- 返利item -->
		<view style="width: 702rpx; display: flex;justify-content: space-between;align-items: center;margin-top: 25rpx;"
		v-for="(item,index) in myfanli" :key="index">
			<view style="display: flex;">
				<image mode="aspectFill" src="../static/my/hp.png" style="width: 90rpx;height: 90rpx;"></image>
				<view style="margin-left: 15rpx; display: flex;flex-direction: column;justify-content: space-between;">
					<view style="font-size: 28rpx;color: #333333;">{{item.memo}}</view>
					<view style="font-size: 20rpx;color: #666666;">{{item.createtime}}</view>
				</view>
			</view>
			<view style="font-size: 28rpx;color: #F07203;">{{item.money}}元</view>
		</view>
		
		
	</scroll-view>
</template>

<script>
	export default {
		data() {
			return {
				page: 1,
				myfanli:{},
				rebateList:[]
			}
		},
		onLoad() {
			this.getMyfanli(0);
		},
		methods: {
			lower(){
				console.log("页面到达了底部");
				this.page = this.page += 1;
				this.getMyfanli(1);
			},
			//获得返利列表
			async getMyfanli(e) {
				console.log("e: ",e);
				console.log("this.page: ",this.page);
				let res;
				try {
					res = await this.$request.get('addons/shopro/user/my_fanli', {
						data: {
							page: this.page,
						},
					});
				} catch (e) {
					//TODO handle the exception
					console.log('e===', e);
					return uni.showToast({
						title: '网络连接失败！',
						icon: 'none'
					});
				}
				this.myfanli = res.data.data.data
				console.log("res: ",res);
			},
		}
	}
</script>

<style>

</style>
